<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css">
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <script type="text/javascript" src="../../script/api.js"></script>
</head>

<body>
    <header class="aui-bar aui-bar-nav">
        <i class="aui-iconfont aui-icon-left aui-pull-left" onclick="api.closeFrame();"></i>
        <div class="aui-title"></div>
    </header>

    <section class="aui-content" id="goods_list">

    </section>
</body>
<script type="text/javascript">
    apiready = function() {
        id = api.pageParam.id;
        api.ajax({
            url: 'http://www.mk517.com/webApi/goodslnfo.php',
            method: 'post',
            dataType: 'json',
            "headers": {
                "Content-Type": "application/json"
            },
            data: {
                body: id
            }
        }, function(ret, err) {
            if (ret) {
                for (var i = 0; i < ret.length; i++) {
                    data = ret[i];
                    day = Math.floor((data.endtime - data.starttime) / 1000 / 60 / 60 / 24);
                    hour = Math.floor((data.endtime - data.starttime) / 1000 / 60 / 60 % 24);
                    minutes = Math.floor((data.endtime - data.starttime) / 1000 / 60 % 60);
                    $api.byId('goods_list').innerHTML +=
                        '<div class="aui-card-list-content-padded">' +
                        '<img src="' + data.img + '" />' +
                        '</div>' +
                        '<div class="aui-card-list-footer">' +
                        '<div class="aui-list-item">' +
                        '<div class="aui-list-item-text"><span style="font-size:26px;color:red;">￥' + data.discount_price + '</span><span><s>￥' + data.price + '</s></span></div>' +
                        '</div>' +
                        '<div class="aui-list-item">' +
                        '<div class="aui-list-item-text"><span style="color:red;font-size:20px;">有返利</span></div>' +
                        '</div>' +
                        '<div class="aui-list-item"></div>' +
                        '<div class="aui-list-item aui-margin-r-0">' +
                        '<div class="aui-list-item-text">距结束仅剩</div>' +
                        '<div class="aui-list-item-text"><span class="aui-bg-warning" style="font-size:16px;">' + day + '</span>天' +
                        '<span class="aui-bg-warning" style="font-size:16px;">' + hour + '</span>时' +
                        '<span class="aui-bg-warning" style="font-size:16px;">' + minutes + '</span>分</div></div></div>' +

                        '<div class="aui-card-list-content-padded">' +
                        '<div class="aui-list-item">' +
                        '<div class="aui-list-item-text">' +
                        '<span>开抢时间：</span><span>10月26日</span><span>21时00分</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="aui-btn">开抢提醒</span></div></div></div>' +

                        '<div class="aui-col-xs-6">' +
                        '<div class="aui-btn aui-btn-block"><i class="aui-iconfont aui-icon-like">收藏</div>' +
                        '</div>' +
                        '<div class="aui-col-xs-6">' +
                        '<div class="aui-btn aui-btn-danger aui-btn-block">返利模式购买</div>' +
                        '</div>'
                }
                // alert(JSON.stringify(ret));
            } else {
                // alert(JSON.stringify(err));
            }
        });

    }
</script>

</html>
